using STHPMS1.ICore.I_Common;
using STHPMS1.ICore.I_DAL;
using STHPMS1.ICore.I_Core;
using STHPMS1.ICore;
using STHPMS1.Common.C_Extension;

namespace STHPMS1.DAL.D_Core
{
	/// <summary>
	/// 数据层接口统一调用处
	/// </summary>
	public class DalFacade : DisposeObject, IDalFacade
	{
		private IDalFactory _factory;

		public IDalFactory Factory {
			get {
				IDalFactory factory = null;
                if (_factory == null)
                {
                    _factory = MyApp.Locator.GetInstance<IDalFactory>();
                }
				factory = _factory;
				return factory;
			}
		}

		public IScene Scene {
			get;
			set;
		}

		#region dao
        public ISthpms1Dao Sthpms1
        {
            get
            {
                return CoreExt.DalFactoryDecorator(CoreExt.ScenceDecorator(Factory.GetSthpms1Dao(this.Scene.IsOpen), this.Scene), this.Factory);
            }
        }
		#endregion

		protected override void OnDispose ()
		{
			Factory.Dispose ();
			_factory = null;
		}


       
    }
}
